package file;

import lombok.Data;

import java.io.FileReader;

/**
 * @time: 2019/11/27 14:35
 * @author: baozi
 * 字符读取流，以单个字符为最小单位
 */
@Data
public class readerDemo1 {


    public static void main(String[] args) {
        try {

            FileReader f=new FileReader("1.txt");
            //单个读取
            /*int i;
            while((i=f.read())!=-1){
                System.out.print((char)i);
            }*/
            //多个读取
            char[] c=new char[1024];
            while(f.read(c)!=-1){
                System.out.print(new String(c));
            }
            f.close();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

}
